import os
import shutil

from tqdm import tqdm



def check(base,predict_string, base_num):
    length = len(predict_string)
    for i in range(length):
        if base_num + i  > length:
            break
        if predict_string[i:i+base_num] in base:
            return 1
    return 0




f = open("results.txt","r",encoding="utf-8").readlines()

num = 0
ac = 0
bad = 0
com_right = 0
vin_img_path = 'D:/BaiduNetdiskDownload/vin/vinimg'
vin_img_savepath = './bad'
bad_img = []
for i in f:
    name,txt,confidence = i.split("\t")
    if len(txt) > 3:
        if check(name,txt, 3):
            ac = ac+1
    else:
        bad = bad +1
    if name ==txt:
        com_right = com_right+1
    num += 1
print(float(com_right)/num)
print(float(ac)/float(num))


